package com.thti.mecool.client.command.result.communication;

import android.os.Bundle;
import android.os.Message;

import com.thti.mecool.client.activity.AddCommicationRecordActivity;
import com.thti.mecool.client.command.ICommand;
import com.thti.mecool.client.protocol.MessageInfo;
import com.thti.mecool.client.protocol.communication.AddCommunicationResult;
import com.thti.mecool.client.service.Protocol;

public class AddCommunicationCommand implements ICommand{

	@Override
	public void doCommand(Object o) {
	
		AddCommunicationResult addCommunicationResult=(AddCommunicationResult)o;
		MessageInfo messageInfo = addCommunicationResult.getMsg();
		if (messageInfo != null) {
			Message msg = new Message();
			msg.what=0xAB;
			Bundle bundle = new Bundle();
			bundle.putSerializable("commessage", messageInfo);
			msg.setData(bundle);
			AddCommicationRecordActivity.handler.sendMessage(msg);
			System.out.println( messageInfo.getContent());
		}
	}

	@Override
	public String getCommandID() {
		
		return Protocol.getAddCommunication;
	}

	@Override
	public Class<?> getCommandClass() {
		// TODO Auto-generated method stub
		return AddCommunicationResult.class;
	}

}
